#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n; cin >> n;
    string s; cin >> s;
    stack<char> stk;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '(') stk.push(s[i]);
        else {
            if (stk.size() && stk.top() == '(') stk.pop();
            else stk.push(s[i]);
        }
    }
    if (stk.size()) cout << "No" << '\n';
    else cout << "Yes" << '\n';

    return 0;
}